package com.example.test.启动线程;

public class ThreadLocl {

    public static void main(String[] args) {
        ThreadLocal<String> threadLocal = ThreadLocal.withInitial(String::new);

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                threadLocal.set("hello world");
            }
        });

        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(threadLocal.get());
            }
        });

        thread.start();
        thread1.start();

    }
}
